import java.util.Scanner;

public class Workfor2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.print("请输入金字塔的行数n: ");
        int n = scanner.nextInt();

        System.out.println(n + "行的金字塔图案:");
        printPyramid(n);

        scanner.close();
    }

    // 打印金字塔图案
    public static void printPyramid(int n) {
        for (int i = 1; i <= n; i++) {
            // 打印前导空格
            for (int j = 1; j <= n - i; j++) {
                System.out.print(" ");
            }
            // 打印星号
            for (int k = 1; k <= 2 * i - 1; k++) {
                System.out.print("*");
            }
            // 换行
            System.out.println();
        }
    }
}